package cloud.authentication.server.authentication.service;

import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.stereotype.Service;

import cloud.authentication.server.po.Resource;

@Service
public interface IResourceService {

	/**
	 * 动态新增更新权限
	 * @param resource
	 */
	void saveResource(Resource resource);

	/**
	 * 动态删除权限
	 * @param resource
	 */
	void removeResource(Resource resource);
	
	/**
	 * 加载权限资源数据
	 * @return
	 */
	Map<RequestMatcher,ConfigAttribute> loadResource();
	
	/**
	 * 
	 * @param authRequest
	 * @return
	 */
	ConfigAttribute findConfigAttributesByUrl(HttpServletRequest authRequest);
	
	/**
	 * 根据用户名查询，该用户所拥有的的角色对应的资源信息
	 * @param username
	 * @return
	 */
	Set<Resource> queryByUsername(String username);
	
}
